<?php
include_once("include/config.php");
include("include/lock");
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<link rel="stylesheet" href="style/style.css" />
	
	<script type="text/javascript" src="js/jquery-1.2.3.min.js"></script>
	<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
	<script type="text/javascript" src="js/jquery-ui-1.8.18.custom.js"></script>
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/achat.js"></script>
	<title>Achat de Musique</title>
</head>

<body>

<!--------------------------------- HEADER ---------------------------------->

	<?php
		include("include/header.php");
	?>


<!------------------------------- NAVIGATION -------------------------------->
	
	<?php
		include("include/nav.php");
	?>
		
<!--------------------------------- SECTION --------------------------------->
	
	<section>
		<article>
			<div id="ssarticle">
<?php 
if(isset($_GET["musique"]))
{
  $musique = MusiqueQuery::create()
    ->findOneById($_GET["musique"]);
  $artistMusiques = ArtistMusiqueQuery::create()
    ->filterByMusiqueId($musique->getId())
		->findOne();
	$artiste = ArtistQuery::create()
	  ->findOneById($artistMusiques->getArtistId());
  if(isset($musique) && isset($artiste))
  {
    echo "<h1>".$musique->getTitle()." (".$artiste->getNom().")</h1>\n";
    echo "<b>Prix: ".$musique->getPrix()."</b><br/>\n";
    echo "<form action=\"\" id=\"acheter\">";
    echo "<input type=\"hidden\" name=\"id\" value=\"{$_GET["musique"]}\" />\n"; 
    echo "<input type=\"submit\" name=\"acheter\" value=\"Acheter\"/>\n";
    echo "</form>";
    
  } else {
    echo "<div class=\"error_box\">Musique inexistant :P</div>\n";
  }  
  
}
?>
			</div>
		</article>
	</section>
	
<!--------------------------------- FOOTER ---------------------------------->	

	<?php
		include("include/footer.php");
	?>
	
	
<!--------------------------------------------------------------------------->

</body>
</html>
